package com.partner.action.scenicspot;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.partner.bean.scenicspot.TPublicfacilitiesVo;
import com.partner.frame.common.CommonInstans;
import com.partner.service.scenicspot.TPublicfacilitiesService;

/** 
 * @ClassName: PublicFacilitiesManagerAction 
 * @Description: 景区管理-->公共设施控制器
 * @author Lizuoyang 
 * @date 2017年5月8日 下午3:55:10  
 */ 
@Controller
@RequestMapping("/publicfacilities")
public class PublicFacilitiesManagerAction {
	
	@Autowired
	private TPublicfacilitiesService publicfacilitiesService;
	
	/**
	 * @Title      : publicfacilitieslist 
	 * @Description: 公共设施 查询所有公共设施 及 公共设施类型 (多条件查询) 并跳转至公共设施列表界面
	 * @param vo		
	 * @return     : ModelAndView
	 * @author     : Lizuoyang
	 * Create Date : 2017年5月8日 下午3:58:17
	 * @throws 
	 */
	@RequestMapping(value="/publicfacilitieslist",method=RequestMethod.GET)
	public ModelAndView publicfacilitieslist(HttpServletRequest request,TPublicfacilitiesVo vo){
		ModelAndView mv = new ModelAndView();
		
		//获取登录成功存放于session中的景区ID
		int sceid = (int)request.getSession().getAttribute(CommonInstans.SCENICSPOTID);
		
		List<TPublicfacilitiesVo> publicfacilitiesByScenidSpotId = publicfacilitiesService.getPublicfacilitiesByScenidSpotId(sceid);
		
		
		mv.addObject("pubfac", publicfacilitiesByScenidSpotId);
		mv.setViewName("/pages/scenic/publicfacilities/publicfacilitieslist");
		return mv;
	}

}
